<template>
	<view>
		<view class="toolbar">
			<view class="link">综合</view>
			<view class="link">销量</view>
			<view class="liststyle">
				<text :class="btnstyle" @click="changeStyle"></text>
			</view>
		</view>
		<view :class="goodsView">
			<view class="goods">
				<view class="img">
					<image class="goodsimg" src="../../static/goods/1.jpg" mode="widthFix" style="width: 100%;"></image>
				</view>
				<view class="info">
					<text>精品篮球鞋1代</text>
					<text>价格:128.00</text>
					<text>1件包邮</text>
				</view>
				<view class="btn">
					<button class="buy">立即购买</button>
				</view>
			</view>
			<view class="goods">
				<view class="img">
					<image class="goodsimg" src="../../static/goods/1.jpg" mode="widthFix" style="width: 100%;"></image>
				</view>
				<view class="info">
					<text>精品篮球鞋1代</text>
					<text>价格:128.00</text>
					<text>1件包邮</text>
				</view>
				<view class="btn">
					<button class="buy">立即购买</button>
				</view>
			</view>
			<view class="goods">
				<view class="img">
					<image class="goodsimg" src="../../static/goods/1.jpg" mode="widthFix" style="width: 100%;"></image>
				</view>
				<view class="info">
					<text>精品篮球鞋1代</text>
					<text>价格:128.00</text>
					<text>1件包邮</text>
				</view>
				<view class="btn">
					<button class="buy">立即购买</button>
				</view>
			</view>
			<view class="goods">
				<view class="img">
					<image class="goodsimg" src="../../static/goods/1.jpg" mode="widthFix" style="width: 100%;"></image>
				</view>
				<view class="info">
					<text>精品篮球鞋1代</text>
					<text>价格:128.00</text>
					<text>1件包邮</text>
				</view>
				<view class="btn">
					<button class="buy">立即购买</button>
				</view>
			</view>
			<view class="goods">
				<view class="img">
					<image class="goodsimg" src="../../static/goods/1.jpg" mode="widthFix" style="width: 100%;"></image>
				</view>
				<view class="info">
					<text>精品篮球鞋1代</text>
					<text>价格:128.00</text>
					<text>1件包邮</text>
				</view>
				<view class="btn">
					<button class="buy">立即购买</button>
				</view>
			</view>
			<view class="goods">
				<view class="img">
					<image class="goodsimg" src="../../static/goods/1.jpg" mode="widthFix" style="width: 100%;"></image>
				</view>
				<view class="info">
					<text>精品篮球鞋1代</text>
					<text>价格:128.00</text>
					<text>1件包邮</text>
				</view>
				<view class="btn">
					<button class="buy">立即购买</button>
				</view>
			</view>
			<view class="goods">
				<view class="img">
					<image class="goodsimg" src="../../static/goods/1.jpg" mode="widthFix" style="width: 100%;"></image>
				</view>
				<view class="info">
					<text>精品篮球鞋1代</text>
					<text>价格:128.00</text>
					<text>1件包邮</text>
				</view>
				<view class="btn">
					<button class="buy">立即购买</button>
				</view>
			</view>
			<view class="goods">
				<view class="img">
					<image class="goodsimg" src="../../static/goods/1.jpg" mode="widthFix" style="width: 100%;"></image>
				</view>
				<view class="info">
					<text>精品篮球鞋1代</text>
					<text>价格:128.00</text>
					<text>1件包邮</text>
				</view>
				<view class="btn">
					<button class="buy">立即购买</button>
				</view>
			</view>


		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		toRefs,
		reactive
	} from 'vue';

	const goodsView = ref("list")
	const btnstyle = ref("iconfont icon-shuanglieliebiao");

	const changeStyle = () => {
		if (goodsView.value == "list") {
			goodsView.value = "block";
			btnstyle.value = "iconfont icon-liebiao";
		} else {
			goodsView.value = "list";
			btnstyle.value = "iconfont icon-shuanglieliebiao";
		}

	}

	//设置头部颜色
	uni.setNavigationBarColor({
		frontColor: "#fff",
		backgroundColor: "#f1592b"
	})
</script>

<style lang="scss" scoped>
	@import "http://at.alicdn.com/t/c/font_3630446_dwhc0vwzzae.css";

	.toolbar {
		background-color: #f1f2f1;
		padding: 20rpx 15rpx;

		.link {
			display: inline-block;
			margin-right: 80rpx;
			font-size: $uni-font-size-base;
		}

		.liststyle {
			display: inline-block;
			float: right;
			font-size: 30rpx;
		}
	}

	.list {
		// display: flex;
		// flex-flow: column wrap;

		.goods {
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;

			.img {
				flex: 1;
			}

			.info {
				flex: 1;
				display: flex;
				flex-direction: column;

				.t,
				.p,
				.m {
					flex: 1;
				}
			}

			.buy {
				flex: 1;
				background-color: #f1592b;
				color: #fff;

			}
		}
	}

	.block {

		display: flex;
		flex-direction: row;
		flex-wrap: wrap;

		.goods {
			width: 50%;
			// flex: 1;

			.btn {
				padding: 10rpx;

				.buy {
					background-color: #f1592b;
					color: #fff;
				}
			}
		}

	}
</style>
